package com.sc.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 封装分页查询结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageResult<T> implements Serializable {

    private long total;        // 总记录数
    private List<T> records;   // 当前页数据集合
    private int page;          // 当前页码
    private int pageSize;      // 每页记录数

    // 新增的构造函数，包含分页信息
    public PageResult(long total, List<T> records) {
        this.records = records;
        this.total = total;
    }
    // 新增的构造函数，包含分页信息
    public PageResult(List<T> records, long total, int page, int pageSize) {
        this.records = records;
        this.total = total;
        this.page = page;
        this.pageSize = pageSize;
    }

}
